package com.stronger.common.Eume;

import java.util.Arrays;


public enum MessageType {
    QQ(1,"QQ"),
    WECHAT(2,"wechat"),
    SMS(3,"sms");

    int type;
    String name;

    MessageType(int type, String name) {
        this.type = type;
        this.name = name;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static String getNameByType(int type){
        MessageType messageType = Arrays.stream(MessageType.values())
                .filter(v -> v.getType() == type)
                .findFirst()
                .orElseThrow(() -> new RuntimeException("没有当前枚举"));
        return messageType.getName();
    }
}
